package wstrader.task.trade.allocation;

import java.sql.ResultSet;

import pc.system.Tasks;
import wstrader.task.trade.TradeTask;



	public class Contract extends TradeTask {

		  public Contract(Tasks owner)
		  {
		    super(owner);
		  }
		  
		  public long doTask()
		  {
		    String table_name = "Contracts";
		    int task_id     = this.getRequest().getIntValue("task_id");
		    long focused_id = this.getRequest().getLongValue("contracts");
		    long rec_id = this.getRequest().getLongValue("rec_id");
		    switch (task_id)
			{
		      case 1 : // Update
		      	if(rec_id > 0)
		      	{
		      		//focused_id = doUpdate(table_name,focused_id);
		      	}
		        break;
		      case 2 : // Delete
		        //focused_id = doDelete(table_name,focused_id);
		        focused_id = 1;
		        break;
		      default : // View only
		        break;
		      case 3 : // Close Out
		      	//focused_id = doCloseOut();
		    }
		    this.setFocusedID(focused_id);

		    return focused_id;
		  }  
		  
		  public ResultSet fetchPurCntUnAlcList()
		  {
		  	int ScntCntNo = getRequest().getIntValue("contracts");
		  	String Sql = "Select * from contracts where type='P'";// where contract_id = " + PcntCntNo + " order by id";
		  	return getSQLCommand().executeQuery(Sql);
		  }
		  
	}

